package cn.yeziji.forum.controller;

import cn.yeziji.forum.common.ForumResult;
import cn.yeziji.forum.service.pay.WxPayService;
import cn.yeziji.forum.utils.ForumResultUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 支付控制器
 *
 * @author hwy
 * @since 2023/07/29 1:02
 **/
@RestController
@RequestMapping("/pay")
public class PayController {
  @Resource
  private WxPayService wxPayService;
  @PostMapping("/wxPay")
  public ForumResult wxPay() {
    return ForumResultUtils.ok(wxPayService.nativePay(19));
  }

  @RequestMapping(value = "/notify/{notice}", method = {RequestMethod.GET, RequestMethod.POST})
  public ForumResult payNotify(@PathVariable("notice") String notice) {
    return wxPayService.payNotify(notice);
  }
}
